package com.greatwqs.wmall.task.provider.scheduled;

import com.greatwqs.wmall.user.client.service.UserClientService;

import lombok.extern.slf4j.Slf4j;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @author wang-qingsong
 */
@Slf4j
@Component
public class ExpiredTokenDeleteTask {

    @DubboReference(version = "v1")
    private UserClientService userClientService;

    @Scheduled(fixedDelay = 10, timeUnit = TimeUnit.SECONDS)
    public void deleteExpiredTokens() {
        log.info("ExpiredTokenDeleteTask deleteExpiredTokens() calling");
        userClientService.deleteExpiredTokens();
    }
}
